/*
 * Copyright (c) 2010 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.google.api.data.gdata.v2.model;

import com.google.api.client.util.Key;

/**
 * Postal address split into components. It allows to store the address in
 * locale independent format. The fields can be interpreted and used to generate
 * formatted, locale dependent address. The following elements represent parts
 * of the address: agent, house name, street, P.O. box, neighborhood, city,
 * subregion, region, postal code, country. The subregion element is not used
 * for postal addresses, it is provided for extended uses of addresses only. In
 * order to store postal address in an unstructured form formatted address field
 * is provided.
 * 
 * @since 2.2
 * @author Nicolas Garnier
 */
public class StructuredPostalAddress {

  public static final String REL_HOME = "http://schemas.google.com/g/2005#home";
  public static final String REL_WORK = "http://schemas.google.com/g/2005#work";
  /**
   * An address which is neither home nor work. label can be used to indicate
   * the actual type.
   */
  public static final String REL_OTHER = "http://schemas.google.com/g/2005#other";

  /**
   * Type of the address. Unless specified work type is assumed.
   */
  @Key("@rel")
  public String rel;

  /**
   * Parcels and letters can be sent to the address. Unless other provided this
   * is the default value.
   */
  public static final String MAIL_CLASS_BOTH = "http://schemas.google.com/g/2005#both";

  /** Only letters can be sent to the address. */
  public static final String MAIL_CLASS_LETTERS = "http://schemas.google.com/g/2005#letters";

  /** Only parcels can be sent to the address. */
  public static final String MAIL_CLASS_PARCELS = "http://schemas.google.com/g/2005#parcels";

  /** Address is purely locational and cannot be used for mail. */
  public static final String MAIL_CLASS_NEITHER = "http://schemas.google.com/g/2005#neither";

  /**
   * Classes of mail accepted at the address. Unless specified both is assumed.
   */
  @Key("@mailClass")
  public String mailClass;

  /**
   * This address is for general usage. Unless other provided this is the
   * default value.
   */
  public static final String USAGE_GENERAL = "http://schemas.google.com/g/2005#general";

  /** This address is for local usage. */
  public static final String USAGE_LOCAL = "http://schemas.google.com/g/2005#local";

  /**
   * The context in which this addess can be used. Local addresses may differ in
   * layout from general addresses, and frequently use local script (as opposed
   * to Latin script) as well, though local script is allowed in general
   * addresses. Unless specified general usage is assumed.
   */
  @Key("@usage")
  public String usage;

  /** A general label for the address. */
  @Key("@label")
  public String label;

  /** Specifies the address as primary. Default value is false. */
  @Key("@primary")
  public Boolean primary;

  /**
   * The agent who actually receives the mail. Used in work addresses. Also for
   * 'in care of' or 'c/o'.
   */
  @Key("gd:agent")
  public String agent;

  /**
   * Used in places where houses or buildings have names (and not necessarily
   * numbers), eg. "The Pillars".
   */
  @Key("gd:housename")
  public String housename;

  /**
   * Can be street, avenue, road, etc. This element also includes the house
   * number and room/apartment/flat/floor number.
   */
  @Key("gd:street")
  public String street;

  /**
   * Covers actual P.O. boxes, drawers, locked bags, etc. This is usually but
   * not always mutually exclusive with street.
   */
  @Key("gd:pobox")
  public String pobox;

  /**
   * This is used to disambiguate a street address when a city contains more
   * than one street with the same name, or to specify a small place whose mail
   * is routed through a larger postal town. In China it could be a county or a
   * minor city.
   */
  @Key("gd:neighborhood")
  public String neighborhood;

  /**
   * Can be city, village, town, borough, etc. This is the postal town and not
   * necessarily the place of residence or place of business.
   */
  @Key("gd:city")
  public String city;

  /**
   * Handles administrative districts such as U.S. or U.K. counties that are not
   * used for mail addressing purposes. Subregion is not intended for delivery
   * addresses.
   */
  @Key("gd:subregion")
  public String subregion;

  /**
   * A state, province, county (in Ireland), Land (in Germany), departement (in
   * France), etc.
   */
  @Key("gd:region")
  public String region;

  /**
   * Postal code. Usually country-wide, but sometimes specific to the city (e.g.
   * "2" in "Dublin 2, Ireland" addresses).
   */
  @Key("gd:postcode")
  public String postcode;

  /** The name of the country. */
  @Key("gd:country")
  public String country;

  /** The code of the country. */
  @Key("gd:country@code")
  public String countryCode;

  /** The full, unstructured postal address. */
  @Key("gd:formattedAddress")
  public String formattedAddress;
}
